/* 
 * File:   FormAnalyzer.h
 * Author: Henrique
 *
 * Created on 26 de Outubro de 2011, 11:12
 */

#include "highgui.h"
#include "cv.h"
#include "cxcore.h"
#include "cvaux.h"
#include "Auxiliar.h"
#include "PreProcessamento.h"
#include "ExtratorDeInformacoes.h"
#include "Iterador.h"
#include "ExtratorDeCampos.h"
#include "ExtratorDeCamposSemMarcadores.h"
#include <sstream>
#include <iostream>
#include <fstream>
#include <vector>
#include <utility>
#include <cstring>

using namespace std;
using namespace cv;

#ifndef FORMANALYZER_H
#define	FORMANALYZER_H

class FormAnalyzer {
public:
    FormAnalyzer();
    FormAnalyzer(const FormAnalyzer& orig);
    FormAnalyzer(bool marcador);
    virtual ~FormAnalyzer();

    string compareAnswers(const char * archieveFileName, const char * answerFileName);
    /**
     * Comparará as respostas certas com as obtidas
     * @param archieveFileName o arquivo com as respostas certas
     * @param conteudo as respostas marcadas
     * @return
     */
    string compareAnswers(const char * archieveFileName, Conteudo* conteudo);



    /**
     * Detectará quais foram as respostas marcadas
     * @return A string pra ser formada o Conteudo
     */
    string findAnswer(vector<CvRect> quadriculas, IplImage * dst);


    //Getters e setters
    ExtratorDeCampos* getExtratorDeCoordenadas() const;
    void setExtratorDeCoordenadas(ExtratorDeCampos* ext);
    void setPreprocess(PreProcessamento* preprocess);
    PreProcessamento* getPreprocess() const;
    void setExtratorDeInformacoes(ExtratorDeInformacoes* extratorDeInformacoes);
    ExtratorDeInformacoes* getExtratorDeInformacoes() const;
private:
    ExtratorDeCampos* extratorDeCoordenadas;
    PreProcessamento* preprocess;
    ExtratorDeInformacoes* extratorDeInformacoes;
    vector<CvRect> formaQuadriculas(vector<Campo*> campos);
    double findNumberBlackPixels(IplImage* image, int height, int width);
};

#endif	/* FORMANALYZER_H */

